<?php
class Customer extends AppModel {
	var $name = 'Customer';
	var $displayField = 'name';
	
	public $actsAs = array('Searchable');
	public $filterArgs = array(
		array('name' => 'name', 'type' => 'like'),
		array('name' => 'surname', 'type' => 'like'),
		array('name' => 'address1', 'type' => 'like'),
		array('name' => 'address3', 'type' => 'like'),
		array('name' => 'address4', 'type' => 'like'),
		array('name' => 'address5', 'type' => 'like'),
		array('name' => 'phone1', 'type' => 'like')
	);
	
	var $validate = array(
		'name' => array( 
       		'rule' => 'notEmpty',
        	'message' => 'This field cannot be left blank'
    	),
		'surname' => array( 
       		'rule' => 'notEmpty',
        	'message' => 'This field cannot be left blank'
    	),
		'email' => array( 
       		'rule' => 'notEmpty',
        	'message' => 'This field cannot be left blank'
    	),
		'password' => array( 
       		'rule' => 'notEmpty',
        	'message' => 'This field cannot be left blank'
    	),
		'address1' => array( 
       		'rule' => 'notEmpty',
        	'message' => 'This field cannot be left blank'
    	),
		'address3' => array( 
       		'rule' => 'notEmpty',
        	'message' => 'This field cannot be left blank'
    	),
		'address4' => array( 
       		'rule' => 'notEmpty',
        	'message' => 'This field cannot be left blank'
    	),
		'phone1' => array( 
       		'rule' => 'notEmpty',
        	'message' => 'This field cannot be left blank'
    	),
		'registration_date' => array( 
       		'rule' => 'notEmpty',
        	'message' => 'This field cannot be left blank'
    	)
	);
	//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $belongsTo = array(
		'User' => array(
			'className' => 'User',
			'foreignKey' => 'user_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);

	var $hasMany = array(
		'Order' => array(
			'className' => 'Order',
			'foreignKey' => 'customer_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);

}
?>